package com.admin.dao;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.admin.bean.DownloadLogBean;

@Repository
public class DownloadLogDao {

	
	private static final Logger log = Logger.getLogger(DownloadLogDao.class);
	
	
	@Autowired private JdbcTemplate jdbcTemplate;	
	
	public int insertDwonloadLog(DownloadLogBean bean){
		final String sql = "insert into download_log(imsi,sid,cid,province,create_time)" +
				"values(?,?,?,?,now())";
		try {
			return jdbcTemplate.update(sql, new Object[]{bean.getImsi(),bean.getSid(),bean.getCid(),bean.getProvince()});
		} catch (DataAccessException e) {
			e.printStackTrace();
			return 0;
		}
	}
}
